package com.lucaswangdev.role;

import com.lucaswangdev.Entity;
import com.lucaswangdev.strategy.ChangeStrategy;
import java.util.ArrayList;
import java.util.List;

public abstract class UserRole {
    protected List<ChangeStrategy> changeStrategies = new ArrayList<>();

    public void handleChanges(Entity requestEntity, Entity dbEntity) {
        for (ChangeStrategy strategy : changeStrategies) {
            if (strategy.hasChanged(requestEntity, dbEntity)) {
                strategy.handleChange();
            }
        }
    }
}